﻿using Common.Communal;
using ERP.Domain.CustomerSupplier;
using ERP.Domain.Workorders;
using Sell.Repository.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sell.Services.Workorders
{
    public class WorkorderServices : IWorkorderServices
    {
        public IWorkorderRepository repository { get;}
        public WorkorderServices(IWorkorderRepository _repository)
        {
            repository = _repository;
        }
        /// <summary>
        /// 新增生产工单
        /// </summary>
        /// <param name="workorders"></param>
        /// <returns></returns>
        public async Task<ApiResult<int>> AddWorkorder(Workorder workorders)
        {
            ApiResult<int> res = new ApiResult<int>();
            res.Code = EnumCode.Ok;
            res.Message = "生产工单添加成功";
            var list = await repository.AddAsync(workorders);
            res.Data = list;
            return await Task.FromResult(res);
        }
    }
}
